const throttle = (fn, awaitTime) => {

	let timeout;
	return function() {
		let that = this;
		let args = arguments;

		if (!timeout) {
			timeout = setTimeout(() => {
				timeout = null;
				fn.apply(that, args);

			}, awaitTime);
		}
	};
};

const debounce = (fn, awaitTime) => {
	let time = null
	return function(...args) {
		let ctx = this
		clearTimeout(time)

		time = setTimeout(() => {
			fn.apply(ctx, args)
			time = null
		}, awaitTime)
	}
}
export default {
	throttle,
	debounce
}
